<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949.27">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; min-height: 14.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco; color: #821017}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #631a1e; min-height: 12.0px}
span.s1 {font: 18.0px Helvetica}
span.s2 {color: #0000aa}
span.s3 {color: #000000}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><span class="s1"><b>FMHDecode1<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></b></span><b>decode an FMH signal for a specific speaker</b></p>
<p class="p2"><br></p>
<p class="p1"><b>FMHDecode1.ar(w, x, y, z, r, s, t, u, v, azimuth, elevation, mul, add )</b></p>
<p class="p2"><br></p>
<p class="p1"><b>w</b>, <b>x</b>, <b>y</b>, <b>z</b>, <b>r</b>, <b>s</b>, <b>t</b>, <b>u</b> , <b>v</b> - the components of a second order ambisonic signal</p>
<p class="p1"><b>azimuth</b> - Speaker angle in radians. 0 is front, values should be anti-clockwise (-0.5pi is right, 0.5pi is left)</p>
<p class="p1"><b>elevation</b> - Speaker elevation in radians. 0 to 0.5pi is up, 0 to -0.5pi is down.</p>
<p class="p2"><br></p>
<p class="p1"><b>WARNINGS</b> - Second-order encoding and decoding has some quirks. Decoding for arbitrary arrays will probably not result in the cleanest results. Often, components need to be discarded depending on the kind of speaker array. See: http://www.muse.demon.co.uk/ref/speakers.html for more information. Some of the more common speaker rigs are pre-done for you according to the specifications from Richard Furse's site.<span class="Apple-converted-space"> </span></p>
<p class="p2"><br></p>
<p class="p1">In addition, after a number of conversations with Miguel Negrao (and his contacts with Fons Adriaensen), it is fairly clear that for Second Order decoding to really work well, filtering should be done on the output... for a later date!<span class="Apple-converted-space"> </span></p>
<p class="p2"><br></p>
<p class="p3">(</p>
<p class="p3">{</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="s2">var</span> w, x, y, z, r, s, t, u, v, p, a, b, c, d;</p>
<p class="p4"><span class="Apple-tab-span">	</span></p>
<p class="p3"><span class="Apple-tab-span">	</span>p = <span class="s2">PinkNoise</span>.ar;</p>
<p class="p4"><span class="Apple-tab-span">	</span></p>
<p class="p5"><span class="s3"><span class="Apple-tab-span">	</span></span>// second order B-format encode</p>
<p class="p3"><span class="Apple-tab-span">	</span>#w, x, y, z, r, s, t, u, v = <span class="s2">FMHEncode1</span>.ar(p, <span class="s2">MouseX</span>.kr(-pi, pi),<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s2">MouseY</span>.kr(0.25pi, -0.25pi), 1);<span class="Apple-converted-space"> </span></p>
<p class="p4"><span class="Apple-tab-span">	</span></p>
<p class="p5"><span class="s3"><span class="Apple-tab-span">	</span></span>// B-format decode to cube / quad ([lfh, rfh, rrh, lrh, lfl, rfl, rrl, lrl])</p>
<p class="p5"><span class="s3"><span class="Apple-tab-span">	</span></span>// lfl = left front high, lfl = left front low etc...</p>
<p class="p4"><span class="Apple-tab-span">	</span></p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="s2">FMHDecode1</span>.ar(w, x, y, z, r, s, t, u, v,</p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[-0.25pi, 0.25pi, 0.75pi, 1.25pi,-0.25pi, 0.25pi, 0.75pi, 1.25pi],<span class="Apple-converted-space"> </span></p>
<p class="p3"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>[0.25pi,0.25pi,0.25pi,0.25pi,-0.25pi,-0.25pi,-0.25pi,-0.25pi]);</p>
<p class="p3">}.scope(8);</p>
<p class="p3">)</p>
<p class="p2"><br></p>
<p class="p1"><b>ar1(w, x, y, z, r, s, t, u, v, azimuth, elevation, maxDist, distance, scaleflag, mul, add)</b></p>
<p class="p2"><br></p>
<p class="p1"><b>maxDist - </b>the distance (in meters) to the furthest speaker from center (this allocates the delay size)</p>
<p class="p1"><b>distance</b> - the distance (in meteres) to each speaker.</p>
<p class="p1"><b>scaleflag</b> - if 1, apply amplitude scaling to the closest signals to match more distant speakers</p>
<p class="p2"><br></p>
<p class="p1">The following are some common speaker rigs, with the appropriate components zeroed out</p>
<p class="p6"><br></p>
<p class="p1"><b>stereo(w, y, mul, add)</b></p>
<p class="p6"><br></p>
<p class="p1"><b>square(w, x, y, v, mul, add) - stereo pairs - lf, rf, lr, rr</b></p>
<p class="p1"><b>quad(w, x, y, v, mul, add) - clockwise - lf, rf, rr, lr</b></p>
<p class="p1"><b>pentagon(w, x, y, u, v, mul, add) - center front, rf, rr, lr, lf</b></p>
<p class="p1"><b>hexagon(w, x, y, u, v, mul, add) - lf, rf, r, rr, lr, l</b></p>
<p class="p1"><b>ocatogon1(w, x, y, u, v, mul, add) - lf, rf, rfs, rrs, rr, lr, lrs, lfs</b></p>
<p class="p1"><b>ocatogon1(w, x, y, u, v, mul, add) - f, rf, r, rr, rear, lr, l, lf</b></p>
<p class="p1"><b>cube(w, x, y, z, s, t, v, mul, add) - lfu, rfu, rru, lru, lfd, rfd, rrd, lrd</b></p>
<p class="p1"><b>doubleHex(w, x, y, z, s, t, u, v, mul, add) - lfu, rfu, ru, rru, lru, lu, lfd, rfd, rd, rrd, lrd, ld</b></p>
<p class="p1"><b>dodecahedron(w, x, y, z, r, s, t, u, v, mul, add) - top, fu, rfu, rru, lru, lfu, fd, rfd, rrd, lrd, lfd, bottom</b></p>
<p class="p2"><br></p>
<p class="p2"><br></p>
<p class="p6"><br></p>
<p class="p7">s=Server.internal.boot;</p>
<p class="p8"><br></p>
<p class="p7">(</p>
<p class="p7">{<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">var</span> w, x, y, z, r, s, t, u, v;</p>
<p class="p7"><span class="Apple-tab-span">	</span>#w, x, y, z, r, s, t, u, v =<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s2">FMHEncode1</span>.ar(W<span class="s2">hiteNoise.ar</span>,<span class="s2">MouseX</span>.kr(0, 2pi), <span class="s2">MouseY</span>.kr(-0.5pi, 0.5pi), 1, 0.3);</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">FMHDecode1</span>.stereo(w, y);</p>
<p class="p7">}.scope(5));</p>
<p class="p8"><br></p>
<p class="p7">(</p>
<p class="p7">{<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">var</span> w, x, y, z, r, s, t, u, v;</p>
<p class="p7"><span class="Apple-tab-span">	</span>#w, x, y, z, r, s, t, u, v =<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s2">FMHEncode1</span>.ar(SinOsc<span class="s2">.ar</span>,<span class="s2">MouseX</span>.kr(0, 2pi), <span class="s2">MouseY</span>.kr(-0.5pi, 0.5pi), 1, 0.3);</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">FMHDecode1</span>.pentagon(w, x, y, u, v);</p>
<p class="p7">}.scope(5));</p>
<p class="p8"><br></p>
<p class="p7">(</p>
<p class="p7">{<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">var</span> w, x, y, z, r, s, t, u, v;</p>
<p class="p7"><span class="Apple-tab-span">	</span>#w, x, y, z, r, s, t, u, v =<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s2">FMHEncode1</span>.ar(<span class="s2">WhiteNoise</span>.ar,<span class="s2">MouseX</span>.kr(0, 2pi), <span class="s2">MouseY</span>.kr(-0.5pi, 0.5pi), 1, 0.3);</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">FMHDecode1</span>.cube(w, x, y, z, s, t, v);</p>
<p class="p7">}.scope(8));</p>
<p class="p6"><br></p>
<p class="p6"><br></p>
<p class="p7">(</p>
<p class="p7">{<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">var</span> w, x, y, z, r, s, t, u, v;</p>
<p class="p7"><span class="Apple-tab-span">	</span>#w, x, y, z, r, s, t, u, v =<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s2">FMHEncode1</span>.ar(<span class="s2">SinOsc</span>.ar,<span class="s2">MouseX</span>.kr(0, 2pi), <span class="s2">MouseY</span>.kr(-0.5pi, 0.5pi), 1, 0.3);</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">FMHDecode1</span>.doubleHex(w, x, y, z, s, t, u, v);</p>
<p class="p7">}.scope(12));</p>
<p class="p6"><br></p>
<p class="p7">(</p>
<p class="p7">{<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">var</span> w, x, y, z, r, s, t, u, v;</p>
<p class="p7"><span class="Apple-tab-span">	</span>#w, x, y, z, r, s, t, u, v =<span class="Apple-converted-space"> </span></p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="s2">FMHEncode1</span>.ar(<span class="s2">WhiteNoise</span>.ar,<span class="s2">MouseX</span>.kr(0, 2pi), <span class="s2">MouseY</span>.kr(-0.5pi, 0.5pi), 1, 0.3);</p>
<p class="p7"><span class="Apple-tab-span">	</span><span class="s2">FMHDecode1</span>.dodecahedron(w, x, y, z, r, s, t, u, v);</p>
<p class="p7">}.scope(12));</p>
<p class="p6"><br></p>
</body>
</html>
